package com.ming.common;

import lombok.Data;

@Data
public class Result {
    private Integer code;//业务码

    private String  msg;//业务消息

    private Object data;//业务数据


    /**
     * 业务正常 但是没有业务数据的业务结果
     */
    public Result(){
        this.code = CodeMsg.SUCCESS.code;
        this.msg = CodeMsg.SUCCESS.msg;
    }

    /**
     * 业务正常 有返回数据的结果
     * @param data
     */
    public Result(Object data){
        this();
        this.data = data;
    }

    /**
     * 业务异常
     * @param codeMsg
     */
    public Result(CodeMsg codeMsg){
        this.code = codeMsg.code;
        this.msg = codeMsg.msg;
    }

    /**
     * 自定义的各种Result
     * @param code
     * @param msg
     */
    public Result(Integer code, String msg){
        this.code = code;
        this.msg = msg;
    }
}